<?php
$con = mysql_connect('127.0.0.1', 'root', '');
if (!$con) {
	die('Could not connect: ' . mysql_error());
}
mysql_select_db("ttsl_urlredirectiongateway", $con);

$query = "select * FRom shorturl";
$resut = mysql_query($query);
$row = mysql_fetch_array($resut);
print_r($row);

?>

<html>
<head>
<title>URL</title>
<script type="text/javascript">
    /*function validate() {
        var url = document.getElementById("url").value;
        var pattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
        if (pattern.test(url)) {
            alert("Url is valid");
            return true;
        } 
            alert("Url is not valid!");
            return false;

    }*/
   function validateURL(url) {
    var reurl = /^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}/;
    return re.test(url);
}
function validateForm()
{
    // Validate URL
    var url = $("#url").val();
    if (validateURL(url)) { } else {
        alert("Please enter a valid URL, remember including http://");
    }
/*
    // Validate Title
    var title = $("#frtitle").val();
    if (title=="" || title==null) { } else {
        alert("Please enter only alphanumeric values for your advertisement title");
    }

    // Validate Email
    var email = $("#fremail").val();
    if ((/(.+)@(.+){2,}\.(.+){2,}/.test(email)) || email=="" || email==null) { } else {
        alert("Please enter a valid email");
    }*/
  return false;
}
</script>

</head>
<body>
	<form name="ff1" method="post" action="action.php" onsubmit="validateForm();">
 
		URL :
<input type="text" name="url" id="url" value="" />
<input type="submit" value="Check"/>
<!--<input type="submit" value="Check" onclick="validate();" />-->

	</form>
	<input type="submit" value="Check" onclick="redirecttest(5);" />
 action
	<script type="text/javascript">
	function redirecttest (argument) {
	  <!--
   var retVal = confirm("Do you want to continue ?");
   if( retVal == true ){
     // alert("User wants to continue!");
      window.location="http://localhost/urlgateway/listing_grid.php?ac=suss&id="+argument;
	  return true;
   }else{
    //  alert("User does not want to continue!");
	  return false;
   }
//-->
	}

</script>


	<script type="text/javascript">
function FooController($scope, $window)
{
  $scope.removeUser = function() {
     var deleteUser = $window.confirm('Are you absolutely sure you want to delete?');   

    if (deleteUser) {
      $window.alert('Going to delete the user');
    }

  }
}
</script>

<a class="delete button" href="#" ng-click="removeUser(user, $event)" >Delete6666666666</a>  
</body>
</html>